package com.bw.ppjokeplay.common.mvvm.model

import com.bw.ppjokeplay.common.entity.BaseEntity
import com.bw.ppjokeplay.common.network.ChangeObservable
import com.bw.ppjokeplay.mvvm.model.entity.HomeFeedEntity
import com.google.gson.Gson
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody

abstract class BaseModel : IModel{
    override fun createBody(map: HashMap<String, Any>): RequestBody {
        return RequestBody.create(MediaType.parse("application/json"), Gson().toJson(map))
    }

    override fun changeFun(observable: Observable<*>): Observable<BaseEntity> {
        return observable.map(ChangeObservable())
    }
}